package com.chengma.common;

import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;

@Data
@AllArgsConstructor
public class PageResult<T> {
    private List<T> list;
    private int pageNum;
    private int pageSize;
    private long total;

    public PageResult(List<T> list) {
        PageInfo<?> pageInfo = new PageInfo<>(list);
        this.list = list;
        this.pageNum = pageInfo.getPageNum();
        this.pageSize = pageInfo.getPageSize();
        this.total = pageInfo.getTotal();
    }
}
